<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>狮桥资本车辆交接验收单</title>
    <jsp:include page="../../import.jsp" flush="true"/>
    <jsp:include page="../assParking/assParkCommon.jsp" flush="true" /><!-- 时间格式转换 -->
</head>
<body class="iframeBody">
<div class="Wrapper">
    <div>
        <form id="entryForm">
            <div class="fieldset1 tabel_col clearFix">
                <!-- 基本信息 -->
                <div class="caption">
                    <span class="title"><strong>狮桥资本车辆交接验收单</strong></span>
                </div>
                <div class="fieldBox col_33">
                    <div class="label">承租人</div>
                    <div class="field">
                        <span id="cstNm" name="cstNm">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33">
                    <div class="label">支付表号</div>
                    <div class="field">
                        <span id="paySchNo_1" name="paySchNo_1">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33">
                    <div class="label">车架号</div>
                    <div class="field">
                        <span id="prdVin" name="prdVin">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33">
                    <div class="label">车辆品牌</div>
                    <div class="field">
                        <span id="brandNm" name="brandNm">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33">
                    <div class="label">车系</div>
                    <div class="field">
                        <span id="modelName" name="modelName">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33">
                    <div class="label">车型</div>
                    <div class="field">
                        <span id="styleName" name="styleName">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">表征里程（万）</div>
                    <div class="field">
                        <span id="mil" name="mil">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">车牌号</div>
                    <div class="field">
                        <span id="licensePlateNumber" name="licensePlateNumber">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33">
                    <div class="label">车辆所属省公司</div>
                    <div class="field">
                        <span id="provincialCompany" name="provincialCompany">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33">
                    <div class="label">保管城市</div>
                    <div class="field">
                        <span id="provinceCity" name="provinceCity">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33 bsxx">
                    <div class="label">是否正常行驶</div>
                    <div class="field">
                        <input type="radio" value="1" id="isRun1" name="isRun"/>是
                        <input type="radio" value="0" id="isRun0" name="isRun"/>否
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_33 bsxx">
                    <div class="label">行驶证</div>
                    <div class="field">
                        <input type="radio" value="1" id="isLicense1" name="isLicense"/>有
                        <input type="radio" value="0" id="isLicense0" name="isLicense"/>无
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_33 bsxx">
                    <div class="label">营运证</div>
                    <div class="field">
                        <input type="radio" value="1" id="isCertificate1" name="isCertificate"/>有
                        <input type="radio" value="0" id="isCertificate0" name="isCertificate"/>无
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_33 bsxx">
                    <div class="label">钥匙</div>
                    <div class="field">
                        <input type="radio" value="1" id="isKey1" name="isKey"/>有
                        <input type="radio" value="0" id="isKey0" name="isKey"/>无
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_33">
                    <div class="label">车源编号</div>
                    <div class="field">
                        <span id="carNo" name="carNo">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_66">
                    <div class="label">车辆等级</div>
                    <div class="field">
                        <input name="carLevel" id="carLevel" type="text" class="ui-textbox" value="" placeholder="请选择"
                               ltype="combobox">
                    </div>
                </div>
                <div class="fieldBox col_33">
                    <div class="label">发动机品牌</div>
                    <div class="field">
                        <span id="styleEngine" name="styleEngine">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33" id="engineMaxHorsepowerDIV">
                    <div class="label">发动机马力</div>
                    <div class="field">
                        <span id="engineMaxHorsepower" name="engineMaxHorsepower">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33" id="engMdlDIV">
                    <div class="label">发动机型号</div>
                    <div class="field">
                        <span id="engMdl" name="engMdl">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33" id="gerrboxBrandDIV">
                    <div class="label">变速箱品牌</div>
                    <div class="field">
                        <span id="gerrboxBrand" name="gerrboxBrand">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33" id="gearboxNumDIV">
                    <div class="label">变速箱档位数</div>
                    <div class="field">
                        <span id="gearboxNum" name="gearboxNum">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33" id="shiftModeDIV">
                    <div class="label">变速箱换挡形式</div>
                    <div class="field">
                        <span id="shiftMode" name="shiftMode">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33" id="engFuelnameDIV">
                    <div class="label">燃料类型</div>
                    <div class="field">
                        <span id="engFuelname" name="engFuelname">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33" id="emissionStandardNameDIV">
                    <div class="label">排放标准</div>
                    <div class="field">
                        <span id="emissionStandardName" name="emissionStandardName">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33" id="styleDriveModeDIV">
                    <div class="label">驱动形式</div>
                    <div class="field">
                        <span id="styleDriveMode" name="styleDriveMode">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33">
                    <div class="label">出厂日期</div>
                    <div class="field">
                        <span id="releaseDate" name="releaseDate">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33">
                    <div class="label">上牌日期</div>
                    <div class="field">
                        <span id="licDt" name="licDt">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33">
                    <div class="label">年检到期日</div>
                    <div class="field">
                        <span id="asTm" name="asTm">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33 bsxx">
                    <div class="label">GPS编号</div>
                    <div class="field">
                        <input name="gpsCardNo" id="gpsCardNo" value="" type="text" class="ui-textbox"
                               validate="{required:true}">
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_33 bsxx">
                    <div class="label">轮胎型号</div>
                    <div class="field">
                        <span id="tyreTyresize" name="tyreTyresize">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33 bsxx" id="lightRepeatDIV">
                    <div class="label">后桥规格</div>
                    <div class="field">
                        <span id="lightRepeat" name="lightRepeat">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33 bsxx">
                    <div class="label">上装配置</div>
                    <div class="field">
                        <span id="makeupConfig" name="makeupConfig">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_33 bsxx">
                    <div class="label">冷藏车冷机品牌</div>
                    <div class="field">
                        <input name="refrigeratorBrand" id="refrigeratorBrand" value="" type="text" class="ui-textbox"
                               validate="{required:true}">
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_33 bsxx">
                    <div class="label">搅拌罐整车车长</div>
                    <div class="field">
                        <input name="stirLength" id="stirLength" value="" type="text" class="ui-textbox"
                               validate="{required:true}">
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">交强险</div>
                    <div class="field">
                        <input type="radio" value="1" id="isIns1" name="isIns"/>有
                        (至<input name="insDt" id="insDt" type="text" class="ui-datepicker" value="">&nbsp;)
                        <input type="radio" value="0" id="isIns0" name="isIns"/>无
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">商业险</div>
                    <div class="field">
                        <input type="radio" value="1" id="isCmIns1" name="isCmIns"/>有
                        (至<input name="cmInsDt" id="cmInsDt" type="text" class="ui-datepicker" value="">&nbsp;)
                        <input type="radio" value="0" id="isCmIns0" name="isCmIns"/>无
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">停车场名称</div>
                    <div class="field">
                        <span id="parkNm" name="parkNm">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">停车场地址</div>
                    <div class="field">
                        <span id="parkAddress" name="parkAddress">&nbsp;</span>
                    </div>
                </div>
                <div class="fieldBox col_50 bsxx">
                    <div class="label">交车人签字</div>
                    <div class="field">
                        <input name="handoverNm" id="handoverNm" value="" type="text" class="ui-textbox"
                               validate="{required:true}">
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_50 bsxx">
                    <div class="label">接车人签字</div>
                    <div class="field">
                        <input name="receiverNm" id="receiverNm" value="" type="text" class="ui-textbox"
                               validate="{required:true}">
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_50 bsxx">
                    <div class="label">交车日期</div>
                    <div class="field">
                        <input name="handoverDt" id="handoverDt" type="text" class="ui-datepicker" value=""
                               validate="{required:true}">
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_50 bsxx">
                    <div class="label">接车日期</div>
                    <div class="field">
                        <input name="receiverDt" id="receiverDt" type="text" class="ui-datepicker" value=""
                               validate="{required:true}">
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_100 bsxx">
                    <div class="label">备注</div>
                    <div class="field">
                        <textarea name="handoverRem" id="handoverRem" rows="3" class="l-textarea" style="width:98%"
                                  value=""></textarea>
                    </div>
                </div>
                <!-- 隐藏支付表主键、支付表号 -->
                <div class="fieldBox col_100" style="display:none;">
                    <div class="field">
                        <input name="tcMasterId" id="tcMasterId" type="text" class="ui-textbox" value="${tcMasterId}">
                        <input name="tcDetailId" id="tcDetailId" type="text" class="ui-textbox" value="${tcDetailId}">
                        <input name="paySchId" id="paySchId" type="text" class="ui-textbox" value="${paySchId}">
                        <input name="paySchNo" id="paySchNo" type="text" class="ui-textbox" value="${paySchNo}">
                        <input name="wsPaySchId" id="wsPaySchId" type="text" class="ui-textbox" value="${wsPaySchId}">
                        <input name="wsPaySchNo" id="wsPaySchNo" type="text" class="ui-textbox" value="${wsPaySchNo}">
                        <input name="prjId" id="prjId" type="text" class="ui-textbox" value="${prjId}">
                        <input name="crflag" id="crflag" type="text" class="ui-textbox" value="${crflag}">
                        <input name="tcHvId" id="tcHvId" type="text" class="ui-textbox" value="${tcHvId}">
                        <!-- 上传文件使用：系统时间和当前登录人姓名 -->
                        <input name="delFlag" id="delFlag" type="text" class="ui-textbox" value="">
                        <input name="sysDate" id="sysDate" type="text" class="ui-textbox" value="${sysDate }">
                        <input name="loginUsrNm" id="loginUsrNm" type="text" class="ui-textbox" value="${loginUsrNm }">
                    </div>
                </div>
            </div>
            <div class="btnsBox sbtn1">
                <span id="saveAssEntryBtn" class="sq-button sq-button-round" onclick="saveAssEntry(1)">保存</span>
            </div>
            <div class="fieldset1 tabel_col clearFix">
                <!-- 上传附件 -->
                <div class="fieldBox col_100_auto fjsc">
                    <div class="label">附件上传</div>
                    <div class="field">
                        <select name="attachmentType" id="attachmentType" ligerui="width: 80">
                            <c:if test="${crflag == 'entry' }">
                                <option value="1" selected>入库单</option>
                                <option value="2">出库单</option>
                            </c:if>
                            <c:if test="${crflag == 'out' }">
                                <option value="1">入库单</option>
                                <option value="2" selected>出库单</option>
                            </c:if>
                        </select>
                        <jsp:include page="../assCommFilesUpload.jsp" flush="true">
                            <jsp:param name="filePath" value="ass"/>
                        </jsp:include>
                        <div id="fileUpload1" class="upfileBoxs"></div>
                        <span class="sq-button sq-button-hasicon" id="btnUpload1"
                              onclick="ajaxFileUploadImg('uploads1',1)">
								<i class="sqBtnIco_9"></i>上传
							</span>
                    </div>
                </div>
                <!-- 附件显示 -->
                <div class="fieldBox col_100 fjxs">
                    <div style="width: 98%; margin-left: 1%;">
                        <jsp:include page="../assCommFilesList.jsp" flush="true"></jsp:include>
                        <div id="ligergrid_file1" class="sq-grid"></div>
                    </div>
                </div>
                <!-- 修改拖车申请信息备注 -->
                <div class="fieldBox col_100 crkbz">
                    <div class="label">备注</div>
                    <div class="field">
                        <textarea name="entryOutRem" id="entryOutRem" rows="3" class="l-textarea" style="width:98%"
                                  value=""></textarea>
                    </div>
                </div>
                <div class="tip2" style="text-align: center;line-height: 2.3em;">
                    <font color="red">提示：请先点击上面“保存”按钮,保存“车辆交接验收单”.</font>
                </div>
            </div>
            <div class="btnsBox sbtn2">
                <span id="saveOutEntryBtn" class="sq-button sq-button-round" onclick="saveAssEntry(2)">保存出入库</span>
                <span id="closeBtn" class="sq-button sq-button-round" onclick="closeBtn()">关闭</span>
            </div>
        </form>
    </div>
</div>

<script>
    var _isUpload = 0;//是否上传了附件
    var _operateFlag = 0;//操作标识，用来标识是否保存了车辆交接验收单
    $(function () {
        //$("#entryForm").ligerForm();//初始化表单
        initForm();
        initData();//初始化数据
        initHvData();//初始化数据
        // initVehData();// 初始化车型参数
    });

    //初始化表单
    function initForm() {
        $("#entryForm").ligerForm({
            validate: true
        });
    };

    //初始化数据
    function initData() {
        $("#entryForm").ligerForm({
            validate: true
        });
        var tcDetailId = $("#tcDetailId").val();
        if (!tcDetailId) {
            return;
        }


        //var wait_dialog= $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_LOADING,SQ_type: "waitting"});

        var _url = '<%=path%>/ass/assTrailCarD/getTransferInfo.do';
        $.ajax({
            type: 'get',
            dataType: 'json',
            data: {tcDetailId: tcDetailId},
            url: _url,
            success: function (msg) {
                //wait_dialog.close();
                if (msg.success == 1) {
                    setData(msg.data);//设置数据
                } else {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }

    //违章分数总计分
    function updateOne() {
        var one = 0;//1分
        one = document.getElementById("illegalOne").value;
        var two = 0;//2分
        two = document.getElementById("illegalTwo").value;
        var three = 0;//3分
        three = document.getElementById("illegalThree").value;
        var six = 0;//6分
        six = document.getElementById("illegalSix").value;
        var twelve = 0;//12分
        twelve = document.getElementById("illegalTwelve").value;
        //给总计分赋值
        document.getElementById('illegalCount').value = 1 * one + 2 * two + 3 * three + 6 * six + 12 * twelve;
    }

    //设置页面数据
    function setData(data) {
        //设置基本信息显示
        $("#cstNm").html(data.cstNm);
        $("#paySchNo_1").html($("#wsPaySchNo").val());
        $("#prdVin").html(data.prdVin);//车架号
        initVehData(data.prdVin);
        $("#brandNm").html(data.brandNm);//品牌
        $("#prdType").html(data.prdType);//车辆类型
        $("#provincialCompany").html(data.provincialCompany);//省公司
        $("#provinceCity").html(data.provinceCd + "-" + data.cityCd);
        $("#parkNm").html(data.parkNm);//停车场
        $("#parkAddress").html(data.parkAddress);//地址

        // $("#illegalCount").html(1 * one + 2 * two + 3 * three + 6 * six + 12 * twelve);//总计分
        //设置出入库备注
        var crflag = $("#crflag").val();
        if (crflag == "entry") {
            if (null != data.enterRem) {
                $("#entryOutRem").val(data.enterRem);
            }
        } else if (crflag == "out") {
            if (null != data.outRem) {
                $("#entryOutRem").val(data.outRem);
            }
        } else {
            if (null != data.enterRem && null != data.outRem) {
                $("#entryOutRem").val(data.enterRem + data.outRem);
            } else if (null != data.enterRem && null == data.outRem) {
                $("#entryOutRem").val(data.enterRem);
            } else if (null == data.enterRem && null != data.outRem) {
                $("#entryOutRem").val(data.outRem);
            }
        }
    }

    //初始化数据
    function initHvData() {
        var tcDetailId = $("#tcDetailId").val();
        if (!tcDetailId) {
            return;
        }
        //var wait_dialog= $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_LOADING,SQ_type: "waitting"});

        var _url = '<%=path%>/ass/assTrailCarM/getHvInfoByDetailId.do';
        $.ajax({
            type: 'get',
            dataType: 'json',
            data: {tcDetailId: tcDetailId},
            url: _url,
            success: function (msg) {
                //wait_dialog.close();
                if (msg.success == 1) {
                    setHvData(msg.data);//设置数据
                } else {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }

    //设置页面数据
    function setHvData(data) {
        //加载表单
        var form = liger.get("entryForm");
        form.setData({
            carCl: data.carCl,
            carLen: data.carLen,
            tokenMileage: data.tokenMileage,
            plateNumber: data.plateNumber,
            isRun: setRadioVal("isRun", data.isRun),
            isLicense: setRadioVal("isLicense", data.isLicense),
            isCertificate: setRadioVal("isCertificate", data.isCertificate),
            isKey: setRadioVal("isKey", data.isKey),
            isQuality: setRadioVal("isQuality", data.isQuality),
            isIns: setRadioVal("isIns", data.isIns),
            insDt: renderDate1(data.insDt),
            otherRem: data.otherRem,
            tyreShouldQty: data.tyreShouldQty,
            tyreNormalQty: data.tyreNormalQty,
            tyreDamageQty: data.tyreDamageQty,
            tyreDefectQty: data.tyreDefectQty,
            tyreSpareQty: data.tyreSpareQty,
            gpsCardNo: data.gpsCardNo,
            isDamage: setRadioVal("isDamage", data.isDamage),
            damageRem: data.damageRem,
            handoverNm: data.handoverNm,
            receiverNm: data.receiverNm,
            handoverDt: renderDate1(data.handoverDt),
            receiverDt: renderDate1(data.receiverDt),
            handoverRem: data.handoverRem,
            illegalOne: data.illegalOne,
            illegalTwo: data.illegalTwo,
            illegalThree: data.illegalThree,
            illegalSix: data.illegalSix,
            illegalTwelve: data.illegalTwelve,
            illegalCount: data.illegalCount,
            //illegalOther: data.illegalOther,
            isTransfer: setRadioVal("isTransfer", data.isTransfer),
            isCmIns: setRadioVal("isCmIns", data.isCmIns),
            cmInsDt: renderDate1(data.cmInsDt),
            isAccident: setRadioVal("isAccident", data.isAccident),
            emiStd: data.emiStd,
            engBrand: data.engBrand,
            engMdl: data.engMdl,
            hp: data.hp,
            bridge: data.bridge,
            playingDt: renderDate1(data.playingDt),
            licDt: renderDate1(data.licDt),
            carAnnualDt: renderDate1(data.carAnnualDt),
            certificateAnnualDt: renderDate1(data.certificateAnnualDt),
            tcHvId: data.id
        });
        $("#boxDesc").html(data.boxDesc);
        showOrEdit();//设置显示-编辑属性
    }

    /**
     * 初始化车型参数
     */
    function initVehData(vin) {
        var tcDetailId = $("#tcDetailId").val();
        if (!tcDetailId) {
            return;
        }
        var _url = '<%=path%>/ass/assTrailCarM/initVehData.do';
        $.ajax({
            type: 'get',
            dataType: 'json',
            data: {tcDetailId: tcDetailId, vin: vin, isNew: '${isNew}'},
            url: _url,
            success: function (msg) {
                //wait_dialog.close();
                if (msg.success == 1) {
                    setVehData(msg.data);//设置数据
                } else {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }

    //设置页面数据
    function setVehData(data) {
        // 车型库信息
        var vehSrcInf = data.vehSrcInf;
        // 拖车交接单信息
        var assTrailCarHv = data.assTrailCarHv;
        var carLevelList = [{"key": "1", "value": "A"}, {"key": "2", "value": "B"}, {
            "key": "3",
            "value": "C"
        }, {"key": "4", "value": "D"}];
        if (null != vehSrcInf) {
            //加载表单
            $("#modelName").html(vehSrcInf.modelName);// 车系
            $("#styleName").html(vehSrcInf.styleName);// 车型
            $("#mil").html(vehSrcInf.mil);// 表征里程
            $("#licensePlateNumber").html(vehSrcInf.licensePlateNumber);// 车牌号
            setRadioVal("isLicense", vehSrcInf.isDrivingLicense);// 行驶证
            $("#carNo").html(vehSrcInf.carNo);// 车源编号
            $("#mil").html(vehSrcInf.mil);
            $("#styleEngine").html(vehSrcInf.styleEngine);// 发动机品牌
            $("#engineMaxHorsepower").html(vehSrcInf.engineMaxHorsepower);// 发动机马力
            $("#engMdl").html(vehSrcInf.engMdl);// 发动机型号
            $("#gerrboxBrand").html(vehSrcInf.gerrboxBrand);// 变速箱品牌
            $("#gearboxNum").html(vehSrcInf.gearboxNum);// 变速箱档位数
            $.each(${shiftModeKV}, function (index, obj) {
                if (obj.key === vehSrcInf.shiftMode) {
                    $("#shiftMode").html(obj.value);// 变速箱换挡形式
                }
            });

            $.each(${fuelTypeKV}, function (index, obj) {
                if (obj.key == vehSrcInf.fuelTypeId) {
                    $("#engFuelname").html(obj.value);// 燃料类型
                }
            });
            $.each(${emissionStandardKV}, function (index, obj) {
                if (obj.key === vehSrcInf.emissionStandard) {
                    $("#emissionStandardName").html(obj.value);// 排放标准
                }
            });
            $.each(${styleDriveModeKV}, function (index, obj) {
                if (obj.key === vehSrcInf.styleDriveMode) {
                    $("#styleDriveMode").html(obj.value);// 驱动形式
                }
            });

            var combobox = $("#carLevel").ligerComboBox({
                data: carLevelList,
                selectBoxWidth: 270,
                selectBoxHeight: 150,
                valueField: "key",
                textField: "value",
            });
            $("#releaseDate").html(renderDate1(vehSrcInf.releaseDate));// 出厂日期
            $("#licDt").html(renderDate1(vehSrcInf.licDt));// 上牌日期
            $("#asTm").html(renderDate1(vehSrcInf.asTm));// 年检到期日
            $("#tyreTyresize").html(vehSrcInf.tyreTyresize);// 轮胎型号
            if ('1' === vehSrcInf.rearAxle) {
                $("#lightRepeat").html('半轴桥');// 后桥规格
            } else if ('2' === vehSrcInf.rearAxle) {
                $("#lightRepeat").html('轮边减速桥');// 后桥规格
            }
            var length = '';
            var width = '';
            var height = '';
            if (null != vehSrcInf.containerWidth) {
                width = vehSrcInf.containerWidth;
            }
            if (null != vehSrcInf.containerHeight) {
                height = vehSrcInf.containerHeight;
            }
            if (null != vehSrcInf.containerLength) {
                length = vehSrcInf.containerLength;
            }
            if ('1' === vehSrcInf.carType) {
                // 牵引车
                $("#makeupConfig").html('货箱宽：' + width + ' 货箱高：' + height);// 上装配置
            } else if ('2' === vehSrcInf.carType) {
                // 自卸车
                $("#makeupConfig").html('货箱长：' + length + ' 货箱宽：' + width + ' 货箱高：' + height);// 上装配置
            } else if ('3' === vehSrcInf.carType) {
                // 卸货车
                $("#makeupConfig").html('货箱长：' + length + ' 货箱宽：' + width + ' 货箱高：' + height);// 上装配置
            } else if ('9' === vehSrcInf.carType) {
                // 挂车
                $("#makeupConfig").html('货箱长：' + length + ' 货箱宽：' + width + ' 货箱高：' + height);// 上装配置
            } else if ('10' === vehSrcInf.carType) {
                // 工程车
                $("#makeupConfig").html('货箱长：' + length + ' 货箱宽：' + width + ' 货箱高：' + height);// 上装配置
            } else if ('11' === vehSrcInf.carType) {
                // 专用车
                $("#makeupConfig").html('货箱宽：' + width + ' 货箱高：' + height);// 上装配置
            }
        }

        if (null != assTrailCarHv) {
            $("#refrigeratorBrand").val(assTrailCarHv.refrigeratorBrand);// 冷藏车冷机品牌
            $("#stirLength").val(assTrailCarHv.stirLength);// 搅拌罐整车车长

            $.each(carLevelList, function (index, obj) {
                if (obj.key == assTrailCarHv.carLevel) {
                    $("#carLevel").val(obj.value);
                    $("#carLevel").selected = true;
                }
            });
        }
        showOrEdit4Veh(data);//设置显示-编辑属性
    }

    /**
     * 设置显示属性
     * @param data
     */
    function showOrEdit4Veh(data) {
        // 车型库信息
        var vehSrcInf = data.vehSrcInf;
        // 拖车交接单信息
        var assTrailCarHv = data.assTrailCarHv;
        $("[name='" + 'isLicense' + "']").attr("disabled", "disabled");
        if (null != vehSrcInf) {
            if ('9' === vehSrcInf.carType || '10' === vehSrcInf.carType || '11' === vehSrcInf.carType) {
                $('#lightRepeatDIV').hide();
            }
            // 挂车
            if ('9' === vehSrcInf.carType) {
                $('#engineMaxHorsepowerDIV').hide();
                $('#engMdlDIV').hide();
                $('#gerrboxBrandDIV').hide();
                $('#gearboxNumDIV').hide();
                $('#shiftModeDIV').hide();
                $('#engFuelnameDIV').hide();
                $('#emissionStandardNameDIV').hide();
                $('#styleDriveModeDIV').hide();
            }
        }
    }

    //保存文件
    function saveFile(info, tcHvId) {
        var flag = "rkd";//默认入库单
        var crflag = $("#crflag").val();
        if (crflag == "out") {
            flag = "ckd";//出库单
        }
        var docArray = JSON.stringify(getUploadResultParams(1));
        var url = "<%=path%>/ass/assTrailCarD/uploadAttchment.do";
        var tcDetailId = $("#tcDetailId").val();
        if (null == docArray) {
            $.ligerDialog.SQalert({content: info, SQ_type: "success"});
            return false;
        } else {
            if (tcDetailId) {//拖车明细表ID不为空执行
                //赋值附件
                var data = {
                    "docArray": docArray,
                    "pkId": tcDetailId,
                    "flag": flag
                };
                //请求
                AjaxUtils.ajaxPost(url, data, function (msg) {
                    if (msg.success == 1) {
                        if (!$("#tcHvId").val() && info != null) {//设置交接单ID
                            $("#tcHvId").val(tcHvId);
                        }
                        //刷新附件页面GRID方法和清空上传按钮
                        refreshUlFileRecList(1);
                        clearUploadResultParams(1);
                        top.$.ligerDialog.SQalert({content: info, SQ_type: "success"});
                    } else {
                        UIUtils.alertError(msg.info);
                    }
                }, true);
            } else {
                $.ligerDialog.SQalert({content: "业务主键为空-不能保存文件！", SQ_type: "error"});
            }
        }
    }

    //显示已上传但是未保存的文件列表
    function showFiles(data, index) {
        var sysDate = $("#sysDate").val();
        var f_Grid = liger.get("ligergrid_file" + index);
        var fileRem = "入库单";//默认入库单
        var crflag = $("#crflag").val();
        if (crflag == "out") {
            fileRem = "出库单";//出库单
        }
        var uploadJOSN = data;
        for (var i = 0; i < uploadJOSN.length; i++) {
            //添加行-追加行
            f_Grid.addRow({
                fileRem: fileRem,
                fileNm: uploadJOSN[i].fileNm,
                crtTm: sysDate,
                audStsCd: "未验证",
                doSthFlag: "1",
                ligerIndex: index,
                id: i
            });
        }

        if (fileRem == "入库单") {
            _isUpload = 1;//选择了入库单附件
        }
    }

    //保存车辆交接单信息
    function saveAssEntry(sflag) {
        var ligerForm = liger.get("entryForm");
        //获取车辆交接单表ID
        var tcHvId = $("#tcHvId").val();
        //判断信息填写情况
        if (sflag == 1 && $("#crflag").val() == "entry") {//资产管理员入库节点
            var isRunLen = $(':radio[name=isRun]:checked').length;//是否正常行驶
            // var isLicenseLen = $(':radio[name=isLicense]:checked').length;//行驶证
            var isCertificateLen = $(':radio[name=isCertificate]:checked').length;//营运证
            var isKeyLen = $(':radio[name=isKey]:checked').length;//钥匙
            // var isQualityLen = $(':radio[name=isQuality]:checked').length;//质保手册
            var isInsLen = $(':radio[name=isIns]:checked').length;//交强险
            // var isDamageLen = $(':radio[name=isDamage]:checked').length;//车身重大损坏
            var isIns = $('input:radio[name="isIns"]:checked').val();//交强险的值
            var isDamage = $('input:radio[name="isDamage"]:checked').val();//车身重大损坏的值
            if (isIns == 1 && $("#insDt").val() == "") {
                top.$.ligerDialog.SQalert({content: "需填写交强险的描述信息", SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }
            if (isDamage == 1 && $("#damageRem").val() == "") {
                top.$.ligerDialog.SQalert({content: "需填写车身重大损坏的描述信息", SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }
            if (!ligerForm.valid() || isRunLen == 0 || isCertificateLen == 0 || isKeyLen == 0 || isInsLen == 0) {
                top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }
        }
        if (sflag == 2) {
            if (!tcHvId) {//_operateFlag != 1
                top.$.ligerDialog.SQalert({content: "请先保存车辆交接验收单", SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }
            if (_isUpload != 1 && $("#crflag").val() == "entry") {
                top.$.ligerDialog.SQalert({content: "请上传附件", SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }
        }


        var crflag = $("#crflag").val();
        if (crflag == "modify1") {//转优车申请
            var isTransfer = $('.wsgh input[name="isTransfer"]:checked').val();
            var isAccident = $('.wssg input[name="isAccident"]:checked').val();
            //验证过户和事故情况
            if (isTransfer == "undefined" || isAccident == "undefined") {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
                return false;
            }
            //验证违章信息文本框
            var list = $(".wswz").find('input[type=text]');
            for (var i = 0; i < list.length; i++) {
                if (list[i].id) {
                    var val = liger.get(list[i].id).getValue();
                    if (!val) {
                        $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
                        return false;
                    }
                }
            }
        }
        //获取表单数据
        var data = ligerForm.getData();
        data['carNo'] = $("#carNo").html();
        data['yearChkDt'] = $("#asTm").html();
        var wait_dialog = null;
        var url = '';
        //不同情况设置不同的url
        if (sflag == "1") {
            if (!tcHvId) {
                url = '<%=path%>/ass/assTrailCarM/addWarehouseInfo.do';
            } else {
                url = '<%=path%>/ass/assTrailCarM/modifyWarehouseInfo.do';
            }
        } else if (sflag == "2") {
            url = '<%=path%>/ass/assTrailCarD/modifyEORem.do';
        } else {
            $.ligerDialog.SQalert({content: "保存标识为空！无法保存！", SQ_type: "warning"});
            return false;
        }
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: data,
            url: url,
            beforeSend: function () {
                wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
            },
            success: function (msg) {
                wait_dialog.close();
                if (msg.success == 1) {
                    if (sflag == "1") {
                        if (!tcHvId && msg.data != null) {//设置交接单ID
                            $("#tcHvId").val(msg.data);
                        }
                        _operateFlag = 1;//交接验收单成功保存标识
                        top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                    } else if (sflag == "2") {
                        saveFile(msg.info, tcHvId);//保存文件
                    }
                } else {
                    top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }

    //设置显示/编辑属性
    function showOrEdit() {
        var list = null;
        var crflag = $("#crflag").val();
        var tcHvId = $("#tcHvId").val();//获取车辆交接单表ID
        //是否显示红色提示字样
        if (!tcHvId) {//为空显示提示
            $(".tip2").removeClass('Hide');
        } else {
            $(".tip2").addClass('Hide');
        }
        //根据标识设置相应的属性
        if (crflag == "entry") {//入库
            $("#entryForm").find(".wsxx").each(function () {
                //设置文本框
                list = $(this).find('input[type=text]');
                for (var i = 0; i < list.length; i++) {
                    if (list[i].id) {
                        liger.get(list[i].id).setDisabled(true);
                    }
                }
                //设置单选组
                $(this).find('input[type=radio]').each(function () {
                    $(this).attr("disabled", true);
                });
            });
            $(".fjsc").removeClass('Hide');
            $(".sbtn1").removeClass('Hide');
            $(".sbtn2").removeClass('Hide');
            //设置交接单附件可删除
            $("#delFlag").val("1");
        } else if (crflag == "out") {//出库
            //设置基本信息不可编辑
            $("#entryForm").find(".bsxx").each(function () {
                //设置文本框
                list = $(this).find('input[type=text]');
                for (var i = 0; i < list.length; i++) {
                    if (list[i].id) {
                        liger.get(list[i].id).setDisabled(true);
                    }
                }
                //设置单选组
                $(this).find('input[type=radio]').each(function () {
                    $(this).attr("disabled", true);
                });
            });
            //设置完善信息不可编辑
            $("#entryForm").find(".wsxx").each(function () {
                //设置文本框
                list = $(this).find('input[type=text]');
                for (var i = 0; i < list.length; i++) {
                    if (list[i].id) {
                        liger.get(list[i].id).setDisabled(true);
                    }
                }
                //设置单选组
                $(this).find('input[type=radio]').each(function () {
                    $(this).attr("disabled", true);
                });
            });
            $(".fjsc").removeClass('Hide');
            $(".sbtn1").addClass('Hide');
            $(".sbtn2").removeClass('Hide');
            $("#handoverRem").attr("disabled", "disabled");
            //设置交接单附件可删除
            $("#delFlag").val("1");
        } else if (crflag == "detail" || crflag == "modify1" || crflag == "modify2") {//查看-修改
            //设置基本信息不可编辑
            $("#entryForm").find(".bsxx").each(function () {
                //设置文本框
                list = $(this).find('input[type=text]');
                for (var i = 0; i < list.length; i++) {
                    if (list[i].id) {
                        liger.get(list[i].id).setDisabled(true);
                    }
                }
                //设置单选组
                $(this).find('input[type=radio]').each(function () {
                    $(this).attr("disabled", true);
                });
            });
            //设置完善信息不可编辑
            if (crflag == "detail" || crflag == "modify1") {
                $("#entryForm").find(".wsxx").each(function () {
                    //设置文本框
                    list = $(this).find('input[type=text]');
                    for (var i = 0; i < list.length; i++) {
                        if (list[i].id) {
                            liger.get(list[i].id).setDisabled(true);
                        }
                    }
                    //设置单选组
                    $(this).find('input[type=radio]').each(function () {
                        $(this).attr("disabled", true);
                    });
                });
                if (crflag == "modify1") {//转优车申请时需要填写违章等信息
                    //设置文本框
                    list = $(".wswz").find('input[type=text]');
                    for (var i = 0; i < list.length; i++) {
                        if (list[i].id) {
                            liger.get(list[i].id).setEnabled(true);
                        }
                    }
                    //设置单选组
                    $(".wsgh").find('input[type=radio]').each(function () {
                        $(this).attr("disabled", false);
                    });
                    $(".wssg").find('input[type=radio]').each(function () {
                        $(this).attr("disabled", false);
                    });
                    $(".fjxs").addClass('Hide');
                    $(".crkbz").addClass('Hide');
                    //设置必填提醒
                    $(".wz").prepend('<span class="requiredSymbol">*</span>');
                    $(".gh").prepend('<span class="requiredSymbol">*</span>');
                    $(".sg").prepend('<span class="requiredSymbol">*</span>');
                }
            } else {//库管补充交接单
                //设置文本框
                list = $(".wswz").find('input[type=text]');
                for (var i = 0; i < list.length; i++) {
                    if (list[i].id) {
                        liger.get(list[i].id).setDisabled(true);
                    }
                }
                //设置单选组
                $(".wsgh").find('input[type=radio]').each(function () {
                    $(this).attr("disabled", true);
                });
                $(".wssg").find('input[type=radio]').each(function () {
                    $(this).attr("disabled", true);
                });
            }
            $(".fjsc").addClass('Hide');
            //保存交接单信息按钮-查看时不可用
            if (crflag == "detail") {
                $(".sbtn1").addClass('Hide');
            }
            $(".sbtn2").addClass('Hide');
            $("#handoverRem").attr("disabled", "disabled");
            $("#entryOutRem").attr("disabled", "disabled");
        }
        liger.get("attachmentType").setDisabled(true);
        //加载文件列表信息
        loadFilesLiger("crkzl", 1, $("#tcDetailId").val());
    }

    //设置单选组选中值
    function setRadioVal(radioNm, val) {
        //获取单选按钮的兄弟元素a-实例化自动生成的-哈哈-模拟选中动作
        $('#' + radioNm + val).siblings('a').trigger('click');
    }

    //取消/关闭当前页签
    function closeBtn() {
        var TAB = top.mainApp.parentTab;
        var currentTabid = TAB.getSelectedTabItemID();
        top.tab.removeTabItem(currentTabid);
    }
</script>
</body>
</html>